import pymysql
try:
    conn=pymysql.connect(
        host='localhost',
        port=3306,
        db='mydb',
        user='root',
        passwd='root',
        charset='utf8')
    cur=conn.cursor()
    shopName = input("请输入你要查询的商品名称：\n")
    sql = "select goods_name,shop_price,market_price from ecs_goods where goods_name='%s'"%shopName
    cur.execute(sql)
    result = cur.fetchall()
    strShopData = "商品名字：%s,本店售价：%d,市场售价：%d"%(result[0])
    print(strShopData)
    if result[0][1] > 2000:
        print("该%s商品价格较高,请确认好购物信息"%shopName)
    conn.commit()
    cur.close()
    conn.close()
except Exception:
    print("数据库连接错误")